//
//  KetvCollectionViewCell.m
//  kr_36
//
//  Created by lmt on 16/1/20.
//  Copyright © 2016年 www.lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "KetvCollectionViewCell.h"

@implementation KetvCollectionViewCell

- (void)dealloc
{
    [_title release];
    [_durantionTime release];
    [_image release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.image = [[UIImageView alloc] init];
        //_image.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_image];
        
        self.title = [[UILabel alloc] init];
        //_title.backgroundColor = [UIColor yellowColor];
        _title.font = [UIFont systemFontOfSize:14];
        _title.textColor = [UIColor whiteColor];
        _title.numberOfLines = 0;
        [_image addSubview:_title];
        [_title release];
        
        self.durantionTime = [[UILabel alloc] init];
        //_durantionTime.backgroundColor = [UIColor cyanColor];
        _durantionTime.font = [UIFont systemFontOfSize:10];
        _durantionTime.textColor = [UIColor whiteColor];
        [_image addSubview:_durantionTime];
        [_durantionTime release];
        [_image release];
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
    
    _image.frame = CGRectMake(0, 0, 355, 200);
    
    _title.frame = CGRectMake(10, 150, layoutAttributes.size.width - 20, 40);
    
    _durantionTime.frame = CGRectMake(layoutAttributes.size.width - 50, 20, 40, 20);
}

@end
